package com.zhaohang.cn.activity;

import android.support.v7.widget.RecyclerView;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.zhaohang.cn.adapter.VidoListAdapter;
import com.zhaohang.cn.imptrant.VidoListActivityModle;
import com.zhaohang.cn.imptrant.VidoListActivityView;
import com.zhaohang.cn.modle.VidoListActivityImp;
import com.zhaohang.cn.mybasicactivity.BasicActivity;
import com.zhaohang.cn.mybasicactivity.R;

public class VidoListActivity extends BasicActivity implements VidoListActivityView {

    private RecyclerView mRecyclerView;
    private SmartRefreshLayout mSmartRefreshLayout;
    private VidoListAdapter mAdapter;
    private VidoListActivityModle mModle;

    @Override
    protected int setContentSuccessView() {
        return R.layout.activity_vido_list;
    }

    @Override
    protected void getInitView() {

        setTitleText("视频文件");
        setLeftShow(1,R.mipmap.back);
        mModle = new VidoListActivityImp(VidoListActivity.this);


       mRecyclerView= (RecyclerView) findViewById(R.id.recycleview);
       mSmartRefreshLayout= (SmartRefreshLayout) findViewById(R.id.refreshLayout);

        mSmartRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(RefreshLayout refreshLayout) {

//                mSmartRefreshLayout.finishRefresh();

                mModle.refreshData(mSmartRefreshLayout);

            }
        });

        mSmartRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
            @Override
            public void onLoadMore(RefreshLayout refreshLayout) {

                mSmartRefreshLayout.finishLoadMore();
//                mSmartRefreshLayout.setEnableLoadMore(false);

            }
        });

        mAdapter = new VidoListAdapter(VidoListActivity.this);


    }

    //刷新获取的数据
    @Override
    public void getRefreshData() {
        System.out.println("这是刷新所获取的数据");
    }
}
